<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <body>
        <script>
            //使用reduce函数将二维数组扁平化
            var matrix = [
                [1, 2],
                [3, 4],
                [5, 6]
            ];
            var flatten = matrix.reduce((previous,current)=>{
                return previous.concat(current);
            });
            console.log(flatten);
        </script>
    </body>
</html>